home *** CD-ROM | disk | FTP | other *** search
/ USGS: Oil & Gas Potential…National Wildlife Refuge / USGS - Oil & Gas Potential of the Arctic National Wildlife Refuge - Disc 2.iso / mac / MEcode / MEAggre.for next >
Text File  |  1999-02-11  |  3KB  |  249 lines

  1. c   Program name: MEAggre.for computes distributions of aggregate
  2.  
  3. c     totals.
  4.  
  5. c    Uses sample numbers from MESamp.for and aggregates oil
  6.  
  7. c     and gas in-place or recoverable resources for ANWR plays
  8.  
  9. c     Aggregation is by total area, 1002, undeformed in 1002, and
  10.  
  11. c     deformed in 1002.
  12.  
  13. c
  14.  
  15. c    Written 4/2/98, Schuenemeyer     
  16.  
  17. c
  18.  
  19. c    Input files:
  20.  
  21. c     Unit  8 - Play file, name obtained from Names.dat
  22.  
  23. c     Unit  9 - Rand.dat, index numbers of data to be sampled
  24.  
  25. c                 to obtain correlation
  26.  
  27. c     Unit 10 - Names.dat, Names of play and prospect files, number of
  28.  
  29. c                 replications.
  30.  
  31. c    Output files:
  32.  
  33. c     Unit 11 - AnwrD or AnwrIP, recoverable or in-place aggregate
  34.  
  35. c                 files.
  36.  
  37. c
  38.  
  39.       parameter(epsilon=0.001,lx=50)
  40.  
  41.       character title*70
  42.  
  43.     character pln(11)*25,ppl(11)*15,ppr(11)*15
  44.  
  45.       dimension xo(10000,11),xg(10000,11),nply(11),nud(11),npro(11)
  46.  
  47.      1 ,xso(11),xsg(11),xia(11),so(4),sg(4),tmp(10)          
  48.  
  49.       write(*,2)
  50.  
  51.     2 format(' Program MEAggre.for - Aggregate Distributions'/)
  52.  
  53.       open(9,file='Rand.dat',status='old')
  54.  
  55.       open(10,file='Names.dat',status='old')
  56.  
  57.     4    write(*,*) ' Aggregate in-place or recoverable. Enter 1 or 2)'
  58.  
  59.     read(*,*) ipr
  60.  
  61.     if (ipr.lt.1.or. ipr.gt.2) go to 4
  62.  
  63.     if(ipr.eq.2) then
  64.  
  65.      open(11,file='AnwrD.dat')
  66.  
  67.     else
  68.  
  69.      open(11,file='AnwrIP.dat')
  70.  
  71.     end if
  72.  
  73. c   num is number of successful plays. Corresponds to number of 
  74.  
  75. c    observtions in the play files.  Note that Rand.dat also
  76.  
  77. c    contains 10,000 sample numbers.
  78.  
  79.     num=10000
  80.  
  81.     read(10,'(a70)') title
  82.  
  83.     read(10,*) np
  84.  
  85.     do i = 1,np
  86.  
  87. c   num of plays, undef(1)/def(2) code, percent resource in 1002
  88.  
  89.      read(10,*)id,nply(i),nud(i),npro(i)
  90.  
  91.      nply(i)=nply(i)-num
  92.  
  93. c   play name, name of play file, name of prospect file
  94.  
  95.      read(10,'(3x,a25/3x,a15/3x,a15)')pln(i),ppl(i),ppr(i)
  96.  
  97.     end do
  98.  
  99. c   read play file
  100.  
  101.     do i=1,np
  102.  
  103.      open(8,file=ppl(i),status='old')
  104.  
  105.      read(8,*)
  106.  
  107.       do m=1,num
  108.  
  109.        read(8,*) kd,(tmp(k),k=1,10)
  110.  
  111.        if(ipr.eq.2) then
  112.  
  113. c   recoverable
  114.  
  115.         xo(m,i)=tmp(1)
  116.  
  117.         xg(m,i)=tmp(3)
  118.  
  119.        else
  120.  
  121. c   in place
  122.  
  123.         xo(m,i)=tmp(8)
  124.  
  125.         xg(m,i)=tmp(10)
  126.  
  127.        end if
  128.  
  129.       end do
  130.  
  131.      close (8)
  132.  
  133.     end do
  134.  
  135. c   sample
  136.  
  137.       write(11,47)
  138.  
  139.    47 format(' TotalOil TotalNAGas 1002Oil 1002NAGas Undef1002Oil',
  140.  
  141.      1 ' Undef1002NAGas Def1002Oil Def1002NAGas')
  142.  
  143.       read(9,*)
  144.  
  145.     do m=1,num
  146.  
  147.       read(9,*)id,(xia(j),j=1,np)
  148.  
  149. c   retrieve sample
  150.  
  151.      do j=1,np
  152.  
  153.       na=int(xia(j)+.001)
  154.  
  155.       nar=na-nply(j)
  156.  
  157.       if(nar.le.0) then
  158.  
  159.        xso(j)=0.0
  160.  
  161.        xsg(j)=0.0
  162.  
  163.       else
  164.  
  165. c   xso is oil in mm bbl
  166.  
  167. c   xgo is na gas in b cf
  168.  
  169.        xso(j)=xo(nar,j)
  170.  
  171.        xsg(j)=xg(nar,j)
  172.  
  173.       end if
  174.  
  175.      end do
  176.  
  177.     
  178.  
  179. c   partition sample & get sums
  180.  
  181.       np1=np-1
  182.  
  183.     do k=1,4
  184.  
  185.      so(k)=0.0
  186.  
  187.      sg(k)=0.0
  188.  
  189.     end do
  190.  
  191. c   weight Nig/Aurora (2 large) and Nig/Aurora (many)
  192.  
  193.      xso(np1)=0.3*xso(np1)+0.7*xso(np)
  194.  
  195.      xsg(np1)=0.3*xsg(np1)+0.7*xsg(np)
  196.  
  197.     do j=1,np1
  198.  
  199. c   all ANWR
  200.  
  201.      so(1)=so(1)+xso(j)
  202.  
  203.      sg(1)=sg(1)+xsg(j)
  204.  
  205.      t=real(npro(j))*0.01
  206.  
  207.      to=xso(j)*t
  208.  
  209.      tg=xsg(j)*t
  210.  
  211. c   within 1002
  212.  
  213.      so(2)=so(2)+to
  214.  
  215.      sg(2)=sg(2)+tg
  216.  
  217.      if(nud(j).eq.1) then
  218.  
  219. c   within undeformed
  220.  
  221.       so(3)=so(3)+to
  222.  
  223.       sg(3)=sg(3)+tg
  224.  
  225.      else
  226.  
  227. c   withing deformed
  228.  
  229.       so(4)=so(4)+to
  230.  
  231.       sg(4)=sg(4)+tg
  232.  
  233.      end if
  234.  
  235.     end do
  236.  
  237. c   write aggregate totals
  238.  
  239.     write(11,72) m,(so(k),sg(k),k=1,4)
  240.  
  241.    72 format(i6,8f15.4)
  242.  
  243.     end do
  244.  
  245.       stop
  246.  
  247.       end
  248.  
  249.